import { Alipay } from '@icon-park/react'
import { Button } from '../ui/button'
import { useCreateOrderMutation } from '@/services/order'
import { FC } from 'react'
import { ILesson } from '@/type/lesson'
import { IPackage } from '@/type/package'
interface Props {
  lesson?: ILesson
  pack?: IPackage
}
export const AliPay: FC<Props> = ({ lesson, pack }) => {
  const orderMutation = useCreateOrderMutation()
  const modelName = lesson ? 'lesson' : 'package'
  const modelId = (lesson ? lesson.id : pack?.id) as number
  return (
    <Button
      variant="default"
      className="flex items-center bg-blue-600 hover:bg-blue-500 cursor-pointer"
      onClick={() => orderMutation.mutate({ modelName, modelId })}>
      <Alipay theme="outline" size="27" />
      支付宝
    </Button>
  )
}
